using UnityEngine;

public class CareerGroupButton : MonoBehaviour
{
	public UISprite bckSprite;

	public UILabel titleLabel;

	public UILabel numStarsLabel;

	public UISprite fillSprite;

	private CareerSettings.CareerGroup group;

	public Color notActiveColor;

	public void Init(CareerSettings.CareerGroup group)
	{
		this.group = group;
		titleLabel.text = group.groupName;
		numStarsLabel.text = group.collectedStarCount + "/" + group.totalStarCount;
		fillSprite.fillAmount = (float)group.collectedStarCount / (float)group.totalStarCount;
		base.gameObject.SetActive(true);
		bckSprite.color = ((!group.isActive) ? notActiveColor : Color.white);
	}

	private void OnClick()
	{
		if (!group.isActive)
		{
			UIDialog.instance.ShowOk("Locked", "Pass previous levels to unlock!", "Ok", null);
			return;
		}
		MainNavigationManager mainNavigationManager = NavigationManager.instance as MainNavigationManager;
		mainNavigationManager.careerGroupLayer.ShowWithGroup(group);
	}
}
